<div class="points">
    <div class="nav">
        <a href="#admin/points">
            <div class="nav-li">推荐返利</div>
        </a>
        <div class="nav-li focus">员工提成</div>
    </div>

    <hr />


    <div class="box">
        <h4>员工提成用于商家自行分配的用户推广</h4>
        <table>
            <thead>
                <td class="money"></td>
                <td class="money">订单金额</td>
                <td class="mod">返比(0.01~0.99)</td>
                <td class="method">操作</td>
            </thead>

            {{#each $Cache.bus.guide_config}}

            <tr>
                <td>{{~~$Index+1}}级规则</td>
                {{#if $Private.is_updatting}}
                <td>
                    <input bind-input="{{'max_price'}}" value="{{max_price}}" />
                </td>
                <td>
                    <inputnumber min="0" max="100" fixed="2" event-change="{{'$Top.$Event.guide_config.rate_m_100'}}" value="{{rate*100}}"></inputnumber>%
                </td>
                {{#else}}
                <td>{{max_price}}</td>
                <td>{{rate}}</td>
                {{/if}}
                <td>
                    <button event-click="{{'$Top.$Event.guide_config.update'}}">
                    {{#if $Private.is_updatting}}
                        <small class="icon-disk"></small>完成
                    {{#else}}
                        <small class="icon-pencil"></small>修改
                    {{/if}}
                    </button>
                    <button event-click="{{'$Top.$Event.guide_config.remove'}}"><small class="icon-remove2"></small>删除</button>
                </td>
            </tr>

            {{/each}}


            <tr>
                <td>添加新的规则</td>
                <td>
                    <input bind-input="{{'$Cache.new_guide_config.max_price'}}" value="{{$Cache.new_guide_config.max_price}}" type="text" />
                </td>
                <td>
                    <inputnumber min="0" max="100" fixed="2" event-change="{{'$Event.new_guide_config.rate_m_100'}}" value="{{$Cache.new_guide_config.rate*100}}"></inputnumber>%
                </td>
                <td>
                    <button event-click="{{'$Top.$Event.guide_config.add'}}"><small class="icon-plus"></small>  添加</button>
                </td>
            </tr>

        </table>



        <table>
            <thead>
                <td>编号</td>
                <td>称呼</td>
                <td>手机号</td>
                <td>支付宝账号</td>
                <td>累计</td>
                <td>红利分成</td>
                <td>操作</td>
            </thead>
            {{#each $Cache.bus.guide_list}}
            <tr class="guideinfo">
                <td>
                    {{$Index+1}}
                </td>
                <td>{{user.info.name}}</td>
                <td>{{user.info.mobile_phone}}</td>
                <td>{{#if user.info.alipay}}{{user.info.alipay}}{{#else}}<i>用户未绑定</i>{{/if}}</td>
                <td>{{#Fixed acc}}</td>
                <td>{{#Fixed _money}}</td>
                <td>
                    <button event-click="{{'$Top.$Event.bus.build_guide_url'}}"><small class="icon-attachment"></small>链接</button>
                    <!-- <button>清零</button>
                    <button>编辑</button> -->
                    <button event-click="{{'$Top.$Event.bus.remove_guide'}}"><small class="icon-remove2"></small>移除</button>

                    {{#if state==$Top.config.guide_status.weishenqingduihuan}}
                        <div class="info">用户并未申请兑换</div>
                    {{/if}}
                    {{#if state==$Top.config.guide_status.shenqingduihuanzhong}}
                        <div class="info">用户请求兑换，请将金额转到用户账上</div>
                        <button event-click="{{'$Top.$Event.bus.guide.shenqingduihuanzhong_to_shangjiayijingfukuan'}}" >转账完成</button>
                        <!-- 现在默认是直接全部兑换TODO：兑换上限 -->
                    {{/if}}
                    {{#if state==$Top.config.guide_status.shangjiayijingfukuan}}
                        <div class="info">等待用户确认收款</div>
                    {{/if}}
                </td>
            </tr>
            {{#if guide_link}}
            <tr class="guidelink">
                <td><small class="icon-arrow-up"></small></td>
                <td colspan=4>
                    <jqrcode
                        min-version="3"
                        ec-level="H"
                        size="160"
                        m-image="{{user.info.header_url}}"
                        text="{{guide_link}}"
                        quiet="1"
                        fill="#333"
                        background="#EEE"
                    ></jqrcode>
                    <input class="android" style="width: 80%; font-size: 12px;line-height: 140%;" value="{{guide_link}}" type="text" event-mouseenter="{{'$Top.$Event.bus.guide.select_all'}}">
                </td>
                <td>
                    <copybutton value="{{guide_link}}" event-aftercopy="{{'$Top.$Event.bus.guide.aftercopy_guide_link'}}"><small class="icon-paste"></small>复制</copybutton>
                    <button event-click="{{'$Top.$Event.bus.guide.close_guide_url'}}"><small class="icon-arrow-up2"></small>收起</button>
                </td>
            </tr>
            {{/if}}
            {{/each}}
            <tr class="addinfo">
                <td>
                    添加员工提成
                </td>
                <td>
                    电话号码：
                </td>
                <td>
                    <input type="text" value="{{$Cache.new_guide.phone_number}}" bind-input="{{'$Cache.new_guide.phone_number'}}"/>
                </td>
                <td></td>
                <td>
                    <button event-click="{{'$Event.bus.add_guide'}}"><small class="icon-plus"></small>添加链接</button>
                </td>
            </tr>
        </table>
        <div>
        </div>
    </div>
</div>
